import { del, get, getUserDetail, post, put } from '@/utils/request';

// 用户登录
export const login = async (params: any): Promise<any> => {
	return post('/api/auth/admin/signIn', params);
};

// 通过token获取用户的信息
export const userInfo = async (): Promise<any> => {
	return getUserDetail('/api/manager/byToken');
};

// 只查当前地区的所有的超级管理员
export const getCurrentCitySuper = async (params: any): Promise<any> => {
	return await get('/api/manager/skip', params);
};

// 新增管理员
export const addAdmin = async (params: any): Promise<any> => {
	return await post('/api/auth/admin/signUp', params);
};

// 批量删除管理员
export const deleteAdmin = async (params: number[]): Promise<any> => {
	return await del('/api/manager/delete', params);
};

// 超级管理员 update
export const superUpdate = async (params: any): Promise<any> => {
	return await put('/api/manager/superUpdate', params);
};

// 通过ID获取管理员的信息
export const getInformationById = async (userId: any): Promise<any> => {
	return await get(`/api/manager/${userId}`);
};

export const updatePassword = async (id: any, params: Record<string, any>): Promise<any> => {
	return await put(`/api/manager/update_password/${id}`, params);
};
